<?php

namespace app\controller\mobile;

use app\common\model\User;
use app\common\service\ForumService;
use app\common\service\UserService;
use app\common\util\Result;
use think\annotation\route\Group;
use think\annotation\route\Route;

#[Group('mobile/user')]
class UserController extends MobileAuthorizedController
{
    //关注用户
    #[Route('GET|POST', 'follow')]
    public function follow(User $user)
    {
        $param = request()->param();
        $rule = [
            'user_id|用户ID' => 'require|number',
            'action|操作' => 'require|number',//1关注，0取消关注
        ];
        $this->validate($param, $rule);
        $res = (new UserService(app()))->follow($param, $user);
        return Result::jsonByResult($res);
    }
}